package com.atguigu.gmall.item.controller;

import com.atguigu.gmall.common.bean.ResponseVo;
//import com.atguigu.gmall.item.service.IndexService;
import com.atguigu.gmall.item.service.ItemService;
import com.atguigu.gmall.item.vo.ItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping
public class ItemController {
    @Autowired
    ItemService itemService;
//    @ResponseBody
    @GetMapping("{skuId}.html")
    public String item(@PathVariable("skuId")String skuId , Model model){
        ItemVo itemVo = itemService.queryItemVo(skuId);
        model.addAttribute("itemVo",itemVo);
        return "item";
    }
}
